/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package NetworkRequests;

import Enum.HttpMethod;
import Enum.ConnectType.*;
import Common.NetworkManager;

/**
 *
 * @author Hmong
 */
public abstract class WhoisRequest extends Request {

    private String _Domain;

    protected WhoisRequest(String domain){
        _Domain = domain;
    }

    public String GetDomain(){
        return _Domain;
    }

    public static WhoisRequest Create(String domain, String whoisServer){
        return Create(domain, whoisServer, 43);
    }
    public static WhoisRequest Create(String domain, String whoisServer, int port){
        if (0 != (NetworkManager.ConnectSuccessfulType & CMNet.Socket))
            return new WhoisSocketRequest(domain, whoisServer, port);
        
        /*if ((0 != (NetworkManager.ConnectType & ConnectType.CMNet.Http))
                || (0 != (NetworkManager.ConnectType & ConnectType.CMWap.Http))){*/

            String url = "http://hmongsoft.com/WebService/Whois.aspx";
            String params = "?Domain=" + domain + "&WhoisServer=" + whoisServer + "&Port=" + String.valueOf(port);

            return new WhoisHttpRequest(domain, url, params, HttpMethod.Get);
        /*}

        return null;*/
    }
}
